
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>常用工具函数 · EasyClick开发文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="shell-api.html" />
    
    
    <link rel="prev" href="thread-api.html" />
    

    
        <link rel="shortcut icon" href="/zh-cn/images/ico.png" type="image/x-icon">
    
    
    
    
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="/zh-cn/images/ico.png">
    
    
        
    
    
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../features.html">
            
                <a href="../features.html">
            
                    
                    特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../changelog.html">
            
                <a href="../changelog.html">
            
                    
                    更改记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../getting-start.html">
            
                <a href="../getting-start.html">
            
                    
                    开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="devtools/dev-tools.html">
            
                <a href="devtools/dev-tools.html">
            
                    
                    开发工具介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="devtools/dev-tools-install.html">
            
                <a href="devtools/dev-tools-install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="devtools/dev-tools-project.html">
            
                <a href="devtools/dev-tools-project.html">
            
                    
                    工程相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="devtools/dev-tools-device.html">
            
                <a href="devtools/dev-tools-device.html">
            
                    
                    设备相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="devtools/dev-tools-screen.html">
            
                <a href="devtools/dev-tools-screen.html">
            
                    
                    屏幕相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="devtools/dev-tools-settings.html">
            
                <a href="devtools/dev-tools-settings.html">
            
                    
                    设置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../funcs.html">
            
                <a href="../funcs.html">
            
                    
                    功能函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="global/global.html">
            
                <a href="global/global.html">
            
                    
                    全局模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="global/global-shortcut.html">
            
                <a href="global/global-shortcut.html">
            
                    
                    全局快捷事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="global/selector-node.html">
            
                <a href="global/selector-node.html">
            
                    
                    选择器&节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="acevent-api.html">
            
                <a href="acevent-api.html">
            
                    
                    无障碍事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="event-api.html">
            
                <a href="event-api.html">
            
                    
                    代理事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="image-api.html">
            
                <a href="image-api.html">
            
                    
                    图色函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="device-api.html">
            
                <a href="device-api.html">
            
                    
                    设备函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="file-api.html">
            
                <a href="file-api.html">
            
                    
                    文件函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="http-api.html">
            
                <a href="http-api.html">
            
                    
                    网络函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="thread-api.html">
            
                <a href="thread-api.html">
            
                    
                    线程函数
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.11" data-path="utils-api.html">
            
                <a href="utils-api.html">
            
                    
                    常用工具函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="shell-api.html">
            
                <a href="shell-api.html">
            
                    
                    Shell命令函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="sqlite-api.html">
            
                <a href="sqlite-api.html">
            
                    
                    Sqlite命令函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="ui-custom.html">
            
                <a href="ui-custom.html">
            
                    
                    原生UI定制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="ui-js-inter.html">
            
                <a href="ui-js-inter.html">
            
                    
                    JS编写UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="ui-js-template.html">
            
                <a href="ui-js-template.html">
            
                    
                    模板式UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="ui-native-view.html">
            
                <a href="ui-native-view.html">
            
                    
                    原生UI控件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.3.1" data-path="ui/linearlayout.html">
            
                <a href="ui/linearlayout.html">
            
                    
                    LinearLayout线性布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.2" data-path="ui/framelayout.html">
            
                <a href="ui/framelayout.html">
            
                    
                    FrameLayout帧布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.3" data-path="ui/relativelayout.html">
            
                <a href="ui/relativelayout.html">
            
                    
                    RelativeLayout绝对布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.4" data-path="ui/scrollview.html">
            
                <a href="ui/scrollview.html">
            
                    
                    ScrollView滚动框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.5" data-path="ui/view.html">
            
                <a href="ui/view.html">
            
                    
                    View视图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.6" data-path="ui/button.html">
            
                <a href="ui/button.html">
            
                    
                    Button按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.7" data-path="ui/textview.html">
            
                <a href="ui/textview.html">
            
                    
                    TextView文本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.8" data-path="ui/edittext.html">
            
                <a href="ui/edittext.html">
            
                    
                    EditText输入框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.9" data-path="ui/checkbox.html">
            
                <a href="ui/checkbox.html">
            
                    
                    CheckBox复选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.10" data-path="ui/radiogroup.html">
            
                <a href="ui/radiogroup.html">
            
                    
                    RadioGroup布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.11" data-path="ui/radiobutton.html">
            
                <a href="ui/radiobutton.html">
            
                    
                    RadioButton单选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.12" data-path="ui/spinner.html">
            
                <a href="ui/spinner.html">
            
                    
                    Spinner下拉选择框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.13" data-path="ui/webview.html">
            
                <a href="ui/webview.html">
            
                    
                    WebView内嵌浏览器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.14" data-path="ui/imageview.html">
            
                <a href="ui/imageview.html">
            
                    
                    ImageView图像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.15" data-path="ui/cardview.html">
            
                <a href="ui/cardview.html">
            
                    
                    CardView卡片布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.16" data-path="ui/switch.html">
            
                <a href="ui/switch.html">
            
                    
                    Swtich开关按钮
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="html-ui-custom.html">
            
                <a href="html-ui-custom.html">
            
                    
                    H5 UI定制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../hot-update.html">
            
                <a href="../hot-update.html">
            
                    
                    热更新功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../zk/zk.html">
            
                <a href="../zk/zk.html">
            
                    
                    企业版中控接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../zk/zk-ec-state.html">
            
                <a href="../zk/zk-ec-state.html">
            
                    
                    EC状态控制接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../zk/zk-node.html">
            
                <a href="../zk/zk-node.html">
            
                    
                    全局节点模块接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.2.1" data-path="../zk/global/zk-global-log.html">
            
                <a href="../zk/global/zk-global-log.html">
            
                    
                    日志接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.2" data-path="../zk/global/zk-node-service.html">
            
                <a href="../zk/global/zk-node-service.html">
            
                    
                    节点服务接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.3" data-path="../zk/global/zk-global-click.html">
            
                <a href="../zk/global/zk-global-click.html">
            
                    
                    点击动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.4" data-path="../zk/global/zk-global-multitouch.html">
            
                <a href="../zk/global/zk-global-multitouch.html">
            
                    
                    多点触摸动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.5" data-path="../zk/global/zk-global-swipe.html">
            
                <a href="../zk/global/zk-global-swipe.html">
            
                    
                    滑动动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.6" data-path="../zk/global/zk-global-drag.html">
            
                <a href="../zk/global/zk-global-drag.html">
            
                    
                    拖动动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.7" data-path="../zk/global/zk-global-input.html">
            
                <a href="../zk/global/zk-global-input.html">
            
                    
                    输入动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.8" data-path="../zk/global/zk-global-node.html">
            
                <a href="../zk/global/zk-global-node.html">
            
                    
                    节点操作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.9" data-path="../zk/global/zk-global-systemkey.html">
            
                <a href="../zk/global/zk-global-systemkey.html">
            
                    
                    系统按键接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.10" data-path="../zk/global/zk-global-notice.html">
            
                <a href="../zk/global/zk-global-notice.html">
            
                    
                    通知栏接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.11" data-path="../zk/global/zk-global-floatview.html">
            
                <a href="../zk/global/zk-global-floatview.html">
            
                    
                    悬浮窗接口
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../zk/zk-agent.html">
            
                <a href="../zk/zk-agent.html">
            
                    
                    代理事件模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../zk/zk-image.html">
            
                <a href="../zk/zk-image.html">
            
                    
                    图色模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../zk/zk-device.md">
            
                <span>
            
                    
                    设备模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../zk/zk-file.md">
            
                <span>
            
                    
                    文件模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../zk/zk-http.md">
            
                <span>
            
                    
                    网络模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../zk/zk-utils.md">
            
                <span>
            
                    
                    常用工具模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../zk/zk-shell.md">
            
                <span>
            
                    
                    Shell命令模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.10" data-path="../zk/zk-sqlite.md">
            
                <span>
            
                    
                    Sqlite模块接口 - 开发中
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="plugin/plugins.html">
            
                <a href="plugin/plugins.html">
            
                    
                    插件开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../question-answer.html">
            
                <a href="../question-answer.html">
            
                    
                    常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../agreement.html">
            
                <a href="../agreement.html">
            
                    
                    用户协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../declare.html">
            
                <a href="../declare.html">
            
                    
                    免责声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" >
            
                <span>
            
                    
                    技术交流 QQ群：777164022
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >常用工具函数</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x8BF4;&#x660E;"><b>1. </b>&#x8BF4;&#x660E;</a></li><li><span class="title-icon "></span><a href="#&#x51FD;&#x6570;"><b>2. </b>&#x51FD;&#x6570;</a></li><ul><li><span class="title-icon "></span><a href="#&#x6253;&#x5F00;app&#x76F8;&#x5173;"><b>2.1. </b>&#x6253;&#x5F00;App&#x76F8;&#x5173;</a></li><ul><li><span class="title-icon "></span><a href="#utilsopenapp"><b>2.1.1. </b>utils.openApp</a></li><li><span class="title-icon "></span><a href="#utilsopenappbyname"><b>2.1.2. </b>utils.openAppByName</a></li><li><span class="title-icon "></span><a href="#utilsopenactivity"><b>2.1.3. </b>utils.openActivity</a></li></ul><li><span class="title-icon "></span><a href="#&#x56FE;&#x5E93;&#x76F8;&#x5173;"><b>2.2. </b>&#x56FE;&#x5E93;&#x76F8;&#x5173;</a></li><ul><li><span class="title-icon "></span><a href="#utilsinsertimagetoalbum"><b>2.2.1. </b>utils.insertImageToAlbum</a></li><li><span class="title-icon "></span><a href="#utilsinsertvideotoalbum"><b>2.2.2. </b>utils.insertVideoToAlbum</a></li></ul><li><span class="title-icon "></span><a href="#&#x5176;&#x4ED6;"><b>2.3. </b>&#x5176;&#x4ED6;</a></li><ul><li><span class="title-icon "></span><a href="#utilsreadconfigint"><b>2.3.1. </b>utils.readConfigInt</a></li><li><span class="title-icon "></span><a href="#utilsreadjsonstring"><b>2.3.2. </b>utils.readJSONString</a></li><li><span class="title-icon "></span><a href="#utilsisobjectnull"><b>2.3.3. </b>utils.isObjectNull</a></li><li><span class="title-icon "></span><a href="#utilsisobjectnotnull"><b>2.3.4. </b>utils.isObjectNotNull</a></li><li><span class="title-icon "></span><a href="#utilsgetratio"><b>2.3.5. </b>utils.getRatio</a></li><li><span class="title-icon "></span><a href="#utilsgetrangeint"><b>2.3.6. </b>utils.getRangeInt</a></li><li><span class="title-icon "></span><a href="#utilsistrue"><b>2.3.7. </b>utils.isTrue</a></li><li><span class="title-icon "></span><a href="#utilsfilemd5"><b>2.3.8. </b>utils.fileMd5</a></li><li><span class="title-icon "></span><a href="#utilsdatamd5"><b>2.3.9. </b>utils.dataMd5</a></li><li><span class="title-icon "></span><a href="#utilsrandomint"><b>2.3.10. </b>utils.randomInt</a></li><li><span class="title-icon "></span><a href="#utilsrandomcharnumber"><b>2.3.11. </b>utils.randomCharNumber</a></li><li><span class="title-icon "></span><a href="#utilsgetapkpkgname"><b>2.3.12. </b>utils.getApkPkgName</a></li><li><span class="title-icon "></span><a href="#utilsisappexist"><b>2.3.13. </b>utils.isAppExist</a></li><li><span class="title-icon "></span><a href="#utilsgetappversioncode"><b>2.3.14. </b>utils.getAppVersionCode</a></li><li><span class="title-icon "></span><a href="#utilsgetappversionname"><b>2.3.15. </b>utils.getAppVersionName</a></li><li><span class="title-icon "></span><a href="#utilssetclipboardtext"><b>2.3.16. </b>utils.setClipboardText</a></li><li><span class="title-icon "></span><a href="#utilsgetclipboardtext"><b>2.3.17. </b>utils.getClipboardText</a></li></ul></ul></ul></div><a href="#&#x8BF4;&#x660E;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x8BF4;&#x660E;"><a name="&#x8BF4;&#x660E;" class="anchor-navigation-ex-anchor" href="#&#x8BF4;&#x660E;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x8BF4;&#x660E;</h1>
<ul>
<li>&#x5DE5;&#x5177;&#x7C7B;&#x6A21;&#x5757;&#x51FD;&#x6570;&#x4E3B;&#x8981;&#x662F;&#x8DDF;Android&#x5E38;&#x7528;&#x7684;&#x4FE1;&#x606F;&#x76F8;&#x5173;&#x8054;</li>
<li>&#x5DE5;&#x5177;&#x7C7B;&#x6A21;&#x5757;&#x7684;&#x5BF9;&#x8C61;&#x524D;&#x7F00;&#x662F;utils&#xFF0C;&#x4F8B;&#x5982; utils.requestShowLogPermission()&#x8FD9;&#x6837;&#x8C03;&#x7528;</li>
</ul>
<h1 id="&#x51FD;&#x6570;"><a name="&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x51FD;&#x6570;</h1>
<h2 id="&#x6253;&#x5F00;app&#x76F8;&#x5173;"><a name="&#x6253;&#x5F00;app&#x76F8;&#x5173;" class="anchor-navigation-ex-anchor" href="#&#x6253;&#x5F00;app&#x76F8;&#x5173;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1. &#x6253;&#x5F00;App&#x76F8;&#x5173;</h2>
<h3 id="utilsopenapp"><a name="utilsopenapp" class="anchor-navigation-ex-anchor" href="#utilsopenapp"><i class="fa fa-link" aria-hidden="true"></i></a>2.1.1. utils.openApp</h3>
<ul>
<li>&#x6253;&#x5F00;APP</li>
<li>@param packageName &#x7A0B;&#x5E8F;&#x7684;&#x5305;&#x540D;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false &#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//&#x6253;&#x5F00;&#x5FAE;&#x4FE1;</span>
    utils.openApp(<span class="hljs-string">&quot;com.tencent.mm&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsopenappbyname"><a name="utilsopenappbyname" class="anchor-navigation-ex-anchor" href="#utilsopenappbyname"><i class="fa fa-link" aria-hidden="true"></i></a>2.1.2. utils.openAppByName</h3>
<ul>
<li>&#x6253;&#x5F00;APP&#xFF0C;&#x901A;&#x8FC7;&#x5E94;&#x7528;&#x540D;&#x79F0;</li>
<li>@param appName &#x7A0B;&#x5E8F;&#x540D;&#x79F0;&#xFF0C;&#x6BD4;&#x5982;&#x4ECA;&#x65E5;&#x5934;&#x6761;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false &#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//&#x6253;&#x5F00;&#x5FAE;&#x4FE1;</span>
    utils.openAppByName(<span class="hljs-string">&quot;&#x5FAE;&#x4FE1;&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsopenactivity"><a name="utilsopenactivity" class="anchor-navigation-ex-anchor" href="#utilsopenactivity"><i class="fa fa-link" aria-hidden="true"></i></a>2.1.3. utils.openActivity</h3>
<ul>
<li>&#x6253;&#x5F00;&#x4E00;&#x4E2A;activity&#xFF0C;&#x901A;&#x8FC7;map&#x53C2;&#x6570;<ul>
<li>@param map &#x4F8B;&#x5982;{&quot;action&quot;:&quot;&quot;},key&#x7684;&#x56FA;&#x5B9A;&#x53EA;&#x6709;</li>
<li>action: &#x6807;&#x51C6;&#x7684;android action&#x5B57;&#x7B26;&#x4E32;</li>
<li>uri: uri&#x53EF;&#x4EE5;&#x662F;http&#x7F51;&#x5740;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;file:///&#x5730;&#x5740;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F; URLSchema&#x8BED;&#x6CD5; </li>
<li>type: uri&#x5BF9;&#x5E94;&#x7684;type&#xFF0C;&#x7B49;&#x540C;&#x4E8E;MIME&#x7C7B;&#x578B;&#xFF0C;&#x4F8B;&#x5982;&#x5B89;&#x88C5;apk&#x5305;&#x7684;type&#x662F; application/vnd.android.package-archive</li>
<li>pkg: &#x8981;&#x6253;&#x5F00;&#x7684;activity&#x5BF9;&#x5E94;&#x7684;&#x5305;&#x540D;</li>
<li>className: &#x8981;&#x6253;&#x5F00;&#x7684; className &#x5BF9;&#x5E94;&#x7684;&#x7C7B;&#x540D;</li>
<li>flag: androi&#x6253;&#x5F00;activity &#x6807;&#x51C6;&#x7684;flag&#x6807;&#x5FD7;&#x4F4D;&#xFF0C;&#x7279;&#x6B8A;&#x60C5;&#x51B5;&#x4E0B;&#x53EF;&#x4EE5;&#x586B;&#x5199;</li>
<li>&#x5176;&#x4ED6;&#x7684;&#x90FD;&#x662F;&#x5C5E;&#x4E8E;intent&#x53C2;&#x6570;&#x4E86;</li>
</ul>
</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false &#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//&#x6253;&#x5F00;&#x5B89;&#x88C5;&#x5305;&#x754C;&#x9762;</span>
    <span class="hljs-keyword">var</span> m ={
             <span class="hljs-string">&quot;action&quot;</span>:<span class="hljs-string">&quot;android.intent.action.VIEW&quot;</span>,
             <span class="hljs-string">&quot;uri&quot;</span>:<span class="hljs-string">&quot;file:///sdcard/a.apk&quot;</span>,
             <span class="hljs-string">&quot;type&quot;</span>:<span class="hljs-string">&quot;application/vnd.android.package-archive&quot;</span>
         };
         <span class="hljs-keyword">var</span> x = utils.openActivity(m);
         logd(<span class="hljs-string">&quot;x &quot;</span>+x);

    <span class="hljs-comment">//&#x6253;&#x5F00;&#x6296;&#x97F3;&#x76F4;&#x64AD;</span>
    <span class="hljs-keyword">var</span> map={
        <span class="hljs-string">&quot;uri&quot;</span>:<span class="hljs-string">&quot;snssdk1128://aweme/live/6701887916223941379&quot;</span>,
    };
    utils.openActivity(map);
}
main();
</code></pre>
</blockquote>
<h2 id="&#x56FE;&#x5E93;&#x76F8;&#x5173;"><a name="&#x56FE;&#x5E93;&#x76F8;&#x5173;" class="anchor-navigation-ex-anchor" href="#&#x56FE;&#x5E93;&#x76F8;&#x5173;"><i class="fa fa-link" aria-hidden="true"></i></a>2.2. &#x56FE;&#x5E93;&#x76F8;&#x5173;</h2>
<h3 id="utilsinsertimagetoalbum"><a name="utilsinsertimagetoalbum" class="anchor-navigation-ex-anchor" href="#utilsinsertimagetoalbum"><i class="fa fa-link" aria-hidden="true"></i></a>2.2.1. utils.insertImageToAlbum</h3>
<ul>
<li>&#x5C06;&#x56FE;&#x7247;&#x63D2;&#x5165;&#x5230;&#x76F8;&#x518C;&#x4E2D;&#xFF0C;&#x6B64;&#x65B9;&#x6CD5;&#x4F1A;&#x7ACB;&#x523B;&#x66F4;&#x65B0;&#x76F8;&#x518C;&#x6570;&#x636E;</li>
<li>@param path &#x56FE;&#x7247;&#x8DEF;&#x5F84;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    utils.insertImageToAlbum(<span class="hljs-string">&quot;/sdcard/a.png&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsinsertvideotoalbum"><a name="utilsinsertvideotoalbum" class="anchor-navigation-ex-anchor" href="#utilsinsertvideotoalbum"><i class="fa fa-link" aria-hidden="true"></i></a>2.2.2. utils.insertVideoToAlbum</h3>
<ul>
<li>&#x5C06;&#x89C6;&#x9891;&#x63D2;&#x5165;&#x5230;&#x76F8;&#x518C;&#x4E2D;&#xFF0C;&#x6B64;&#x65B9;&#x6CD5;&#x4F1A;&#x7ACB;&#x523B;&#x66F4;&#x65B0;&#x76F8;&#x518C;&#x6570;&#x636E;</li>
<li>@param path &#x89C6;&#x9891;&#x8DEF;&#x5F84;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    utils.insertVideoToAlbum(<span class="hljs-string">&quot;/sdcard/a.mp4&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h2 id="&#x5176;&#x4ED6;"><a name="&#x5176;&#x4ED6;" class="anchor-navigation-ex-anchor" href="#&#x5176;&#x4ED6;"><i class="fa fa-link" aria-hidden="true"></i></a>2.3. &#x5176;&#x4ED6;</h2>
<h3 id="utilsreadconfigint"><a name="utilsreadconfigint" class="anchor-navigation-ex-anchor" href="#utilsreadconfigint"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.1. utils.readConfigInt</h3>
<ul>
<li>&#x8BFB;&#x53D6;JSON&#x4E2D;&#x7684;&#x6574;&#x578B;&#x6570;&#x636E;</li>
<li>@param jsonObject JSON&#x5BF9;&#x8C61;</li>
<li>@param key  &#x914D;&#x7F6E;&#x9879;&#x76EE;</li>
<li>@return &#x6574;&#x578B;&#xFF0C;&#x627E;&#x4E0D;&#x5230;&#x5C31;&#x8FD4;&#x56DE;0</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> testData = utils.readConfigInt(jsonObject,<span class="hljs-string">&quot;test_key&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsreadjsonstring"><a name="utilsreadjsonstring" class="anchor-navigation-ex-anchor" href="#utilsreadjsonstring"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.2. utils.readJSONString</h3>
<ul>
<li>&#x8BFB;&#x53D6;JSON&#x4E2D;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x636E;</li>
<li>@param jsonObject JSON&#x5BF9;&#x8C61;</li>
<li>@param key        &#x914D;&#x7F6E;&#x9879;&#x76EE;</li>
<li>@return &#x5B57;&#x7B26;&#x4E32; &#x627E;&#x4E0D;&#x5230;&#x5C31;&#x8FD4;&#x56DE;&#x7A7A;&#x5B57;&#x7B26;&#x4E32;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> testData = utils.readConfigString(jsonObject,<span class="hljs-string">&quot;test_key&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsisobjectnull"><a name="utilsisobjectnull" class="anchor-navigation-ex-anchor" href="#utilsisobjectnull"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.3. utils.isObjectNull</h3>
<ul>
<li>&#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x4E3A;&#x7A7A;</li>
<li>@param o &#x5BF9;&#x8C61;</li>
<li>@return true&#x6216;&#x8005;false</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> isNull = utils.isObjectNull(<span class="hljs-string">&quot;test_key&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsisobjectnotnull"><a name="utilsisobjectnotnull" class="anchor-navigation-ex-anchor" href="#utilsisobjectnotnull"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.4. utils.isObjectNotNull</h3>
<ul>
<li>&#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x4E0D;&#x4E3A;&#x7A7A;</li>
<li>@param o &#x5BF9;&#x8C61;</li>
<li>@return true&#x6216;&#x8005;false</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> isNull = utils.isObjectNotNull(<span class="hljs-string">&quot;test_key&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetratio"><a name="utilsgetratio" class="anchor-navigation-ex-anchor" href="#utilsgetratio"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.5. utils.getRatio</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x6BD4;&#x4F8B;&#xFF0C;&#x4F8B;&#x5982;10&#x53C2;&#x6570;&#xFF0C;&#x5C31;&#x662F;&#x8FD4;&#x56DE;10%&#x7684;&#x6BD4;&#x4F8B;&#xFF0C;&#x5982;&#x679C;&#x662F;true&#xFF0C;&#x8BF4;&#x660E;&#x968F;&#x673A;&#x6BD4;&#x4F8B;&#x6B63;&#x786E;&#xFF0C;&#x5426;&#x5219;&#x4E0D;&#x6B63;&#x786E;</li>
<li>@param ratio &#x6D6E;&#x70B9;&#x578B; 1-100</li>
<li>@return true&#x6216;&#x8005;false</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> ratio = utils.getRatio(<span class="hljs-number">20</span>f);
    toast(ratio);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetrangeint"><a name="utilsgetrangeint" class="anchor-navigation-ex-anchor" href="#utilsgetrangeint"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.6. utils.getRangeInt</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x67D0;&#x4E2A;&#x8303;&#x56F4;&#x7684;&#x968F;&#x673A;&#x503C;</li>
<li>@param min &#x6700;&#x5C0F;&#x503C;</li>
<li>@param max &#x6700;&#x5927;&#x503C;</li>
<li>@return &#x5728;min&#x548C;max&#x4E2D;&#x95F4;&#x7684;&#x503C;,&#x5305;&#x542B;&#x6700;&#x5927;&#x548C;&#x6700;&#x5C0F;&#x503C;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> value = utils.getRangeInt(<span class="hljs-number">1</span>,<span class="hljs-number">100</span>);
    toast(value);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsistrue"><a name="utilsistrue" class="anchor-navigation-ex-anchor" href="#utilsistrue"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.7. utils.isTrue</h3>
<ul>
<li>&#x5224;&#x65AD;&#x5E03;&#x5C14;&#x578B;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x4E3A;&#x771F;</li>
<li>@param r &#x5E03;&#x5C14;&#x578B;&#x5BF9;&#x8C61;</li>
<li>@return true &#x6216;&#x8005; false</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> value = utils.isTrue(<span class="hljs-literal">true</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsfilemd5"><a name="utilsfilemd5" class="anchor-navigation-ex-anchor" href="#utilsfilemd5"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.8. utils.fileMd5</h3>
<ul>
<li>&#x6587;&#x4EF6;&#x7684;MD5</li>
<li>@param file &#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
<li>@return &#x6587;&#x4EF6;MD5&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> md5 = utils.fileMd5(<span class="hljs-string">&quot;/sdcard/a.txt&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsdatamd5"><a name="utilsdatamd5" class="anchor-navigation-ex-anchor" href="#utilsdatamd5"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.9. utils.dataMd5</h3>
<ul>
<li>&#x6570;&#x636E;&#x8BA1;&#x7B97;&#x51FA;&#x6765;&#x7684;MD5</li>
<li>@param data &#x6570;&#x636E;</li>
<li>@return &#x6570;&#x636E;MD5&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> md5 = utils.dataMd5(<span class="hljs-string">&quot;data&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsrandomint"><a name="utilsrandomint" class="anchor-navigation-ex-anchor" href="#utilsrandomint"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.10. utils.randomInt</h3>
<ul>
<li>&#x968F;&#x673A;&#x6574;&#x578B;&#x6570;&#x636E;</li>
<li>@param length &#x4F4D;&#x6570;&#xFF0C;&#x8981;&#x968F;&#x673A;&#x4EA7;&#x751F;&#x591A;&#x5C11;&#x4F4D;&#x7684;&#x6574;&#x578B;&#x6570;&#x636E;</li>
<li>@return &#x6574;&#x578B;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> r = utils.randomInt(<span class="hljs-number">2</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsrandomcharnumber"><a name="utilsrandomcharnumber" class="anchor-navigation-ex-anchor" href="#utilsrandomcharnumber"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.11. utils.randomCharNumber</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x968F;&#x673A;&#x7684;&#x6570;&#x5B57;&#x548C;&#x5B57;&#x6BCD;</li>
<li>@param length &#x957F;&#x5EA6;</li>
<li>@return &#x5B57;&#x7B26;&#x4E32;&#x6570;&#x5B57;&#x6DF7;&#x5408;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> r = utils.randomCharNumber(<span class="hljs-number">2</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetapkpkgname"><a name="utilsgetapkpkgname" class="anchor-navigation-ex-anchor" href="#utilsgetapkpkgname"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.12. utils.getApkPkgName</h3>
<ul>
<li>&#x53D6;&#x5F97;App&#x6587;&#x4EF6;&#x7684;&#x5305;&#x540D;</li>
<li>@param filePath &#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
<li>@return &#x5B57;&#x7B26;&#x4E32;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> pkgName = utils.getApkPkgName(<span class="hljs-string">&quot;/sdcard/app.apk&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsisappexist"><a name="utilsisappexist" class="anchor-navigation-ex-anchor" href="#utilsisappexist"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.13. utils.isAppExist</h3>
<ul>
<li>App&#x662F;&#x5426;&#x5DF2;&#x7ECF;&#x5B89;&#x88C5;</li>
<li>@param packageName &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x5305;&#x540D;</li>
<li>@return true &#x4EE3;&#x8868;&#x5DF2;&#x7ECF;&#x5B89;&#x88C5;&#xFF0C;false&#x4EE3;&#x8868;&#x672A;&#x5B89;&#x88C5;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> result = utils.isAppExist(<span class="hljs-string">&quot;com.ss.android.article.news&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetappversioncode"><a name="utilsgetappversioncode" class="anchor-navigation-ex-anchor" href="#utilsgetappversioncode"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.14. utils.getAppVersionCode</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5DF2;&#x5B89;&#x88C5;&#x7684;&#x7A0B;&#x5E8F;&#x7684;&#x7248;&#x672C;&#x6574;&#x578B;&#x6807;&#x793A;</li>
<li>@param packageName &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x5305;&#x540D;</li>
<li>@return &#x6574;&#x578B;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> versionCode = utils.getAppVersionCode(<span class="hljs-string">&quot;com.ss.android.article.news&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetappversionname"><a name="utilsgetappversionname" class="anchor-navigation-ex-anchor" href="#utilsgetappversionname"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.15. utils.getAppVersionName</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5DF2;&#x5B89;&#x88C5;&#x7684;&#x7A0B;&#x5E8F;&#x7684;&#x7248;&#x672C;&#x5B57;&#x7B26;&#x4E32;&#x6807;&#x793A;</li>
<li>@param packageName &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x5305;&#x540D;</li>
<li>@return &#x5B57;&#x7B26;&#x4E32; &#x4F8B;&#x5982; 1.0.0</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> r = utils.getAppVersionName(<span class="hljs-string">&quot;com.ss.android.article.news&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h3 id="utilssetclipboardtext"><a name="utilssetclipboardtext" class="anchor-navigation-ex-anchor" href="#utilssetclipboardtext"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.16. utils.setClipboardText</h3>
<ul>
<li>&#x8BBE;&#x7F6E;&#x526A;&#x8D34;&#x677F;&#x6587;&#x672C;</li>
<li>@param text &#x6587;&#x672C;</li>
<li>@return boolean</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> r = utils.setClipboardText(<span class="hljs-string">&quot;com.ss.android.article.news&quot;</span>);
    toast(<span class="hljs-string">&quot;&#x8BBE;&#x7F6E;&#x7ED3;&#x679C;:&quot;</span>+r);
}
main();
</code></pre>
</blockquote>
<h3 id="utilsgetclipboardtext"><a name="utilsgetclipboardtext" class="anchor-navigation-ex-anchor" href="#utilsgetclipboardtext"><i class="fa fa-link" aria-hidden="true"></i></a>2.3.17. utils.getClipboardText</h3>
<ul>
<li>&#x8BFB;&#x53D6;&#x526A;&#x8D34;&#x677F;&#x6587;&#x672C;</li>
<li>@return string</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">var</span> r = utils.getClipboardText();
    toast(<span class="hljs-string">&quot;&#x8BFB;&#x53D6;&#x7ED3;&#x679C;:&quot;</span>+r);
}
main();
</code></pre>
</blockquote>

<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="thread-api.html" class="navigation navigation-prev " aria-label="Previous page: 线程函数">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="shell-api.html" class="navigation navigation-next " aria-label="Next page: Shell命令函数">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"常用工具函数","level":"1.6.11","depth":2,"next":{"title":"Shell命令函数","level":"1.6.12","depth":2,"path":"zh-cn/funcs/shell-api.md","ref":"zh-cn/funcs/shell-api.md","articles":[]},"previous":{"title":"线程函数","level":"1.6.10","depth":2,"path":"zh-cn/funcs/thread-api.md","ref":"zh-cn/funcs/thread-api.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","code","copy-code-button","-lunr","-search","search-pro","anchor-navigation-ex","hide-element","favicon-absolute","popup"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"search-pro":{},"popup":{},"code":{"copyButtons":true},"favicon-absolute":{"appleTouchIconMore":{},"appleTouchIconPrecomposed152":"/zh-cn/images/ico.png","appleTouchIconPrecomposedMore":{},"favicon":"/zh-cn/images/ico.png"},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"EasyClick开发文档","language":"zh-hans","gitbook":"*","description":"记录EasyClick开发教程和常用的函数"},"file":{"path":"zh-cn/funcs/utils-api.md","mtime":"2020-04-30T03:18:20.858Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-27T06:59:59.950Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

